< previous page page_208 next page >

Page 208
Examples Filename: Conversions.frm
For each of the functions listed in this section, you can click the corresponding button in the example.
Val( )
Val() returns a numeric value for a string variable. If the converted string contains characters other than numbers, Val() converts up to the nonnumeric character. Heres an example:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub cmdVal_Click ()
   Me.Print "Val(""100"")  " & Val("100")

   Me.Print "Val(""10a0"")  " & Val("10a0")

   Me.Print "Val(""a100"")  " & Val("a100")
End Sub
Heres the output:
9f31265bb40b592b1929e18a47ab28e5.gif
100
10
0
CCur( )
CCur() converts any numeric or string expression into a currency value. Heres an example:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub cmdCCur_Click ()
   Dim curAmount As Currency

   curAmount = CCur("5.51")

   Me.Cls
   Me.Print curAmount
End Sub

 
< previous page page_208 next page >

If you like this book, buy it!